<?php
require './configs/config.php';
//require './models/DB.class.php';

require './controllers/IndexController.php';
require './controllers/UserController.php';
require './controllers/GoodsController.php';

function __autoload($classname)
{
	if(file_exists("./models/{$classname}.class.php"))
	{
		require "./models/{$classname}.class.php";
	}	
	else if (file_exists("./controllers/{$classname}.php")) 
	{
		require "./controllers/{$classname}.class.php";
	} 
	else 
	{	
		header ("HTTP/1.0 404 not found");
		echo "<h1>404 Not Found</h1>";
		exit;
	}
}
//获取用户传递的参数
//获取控制器名
$c = (!empty($_GET['c']))?$_GET['c']:'Index';
//获取方法名
$a = (!empty($_GET['a']))?$_GET['a']:'index';
//拼接类名
$classname = $c.'Controller';

$controller = new $classname();
var_dump($controller);
$controller->$a();
